package com.rjpacket.supernews.app.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.rjpacket.supernews.app.R;
import com.rjpacket.supernews.app.adapters.RecyclerViewAdapter;
import com.rjpacket.supernews.app.models.RecycleCategory;

import java.util.LinkedList;
import java.util.List;

public class SaveImageFragment extends Fragment implements View.OnClickListener {
    private RecyclerView recyclerView;

    //用于标识是否加载过一次数据了，不重复加载
    private boolean hasFirstLoad = false;
    private List<RecycleCategory> list;
    private RecyclerViewAdapter adapter;
    private int sequence;

    public SaveImageFragment() {

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_save_image, container, false);
        recyclerView = (RecyclerView) view.findViewById(R.id.save_image_recycle);
        //GridLayoutManager manager = new GridLayoutManager(getActivity(),3);

        //瀑布流的recyclerView
        StaggeredGridLayoutManager staggered = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.HORIZONTAL);
        recyclerView.setLayoutManager(staggered);


        list = new LinkedList<RecycleCategory>();

        adapter = new RecyclerViewAdapter(getActivity(), list);
        recyclerView.setAdapter(adapter);
        return view;
    }

    @Override
    public void onClick(View v) {

    }
}
